package com.ruoyi.customer.web;

import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.customer.domain.Need;
import com.ruoyi.customer.service.INeedService;
import com.ruoyi.system.domain.SysConfig;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 客户需求信息
 *
 * @author cans
 * @date 2021/12/26
 **/
@RestController
@RequestMapping("/customer/need")
public class NeedController extends BaseController {

    @Resource
    private INeedService needService;

    @GetMapping("/list")
    public TableDataInfo list(Need need)
    {
        startPage();
        List<Need> list = needService.selectList(need);
        return getDataTable(list);
    }

    @PostMapping
    public AjaxResult add(@Validated @RequestBody Need need){

        return toAjax(needService.insert(need));
    }

    @DeleteMapping("/{id}")
    public AjaxResult remove(@PathVariable Long id) {

        return toAjax(needService.delete(id));
    }
}
